#include "Triangle.h"

const int TRIANGLE_VERTICES = 3;

/*-----------------------------------------------------------------------------------------------*/
Triangle::Triangle(const std::string& name) : Shape(name)
{
   m_vertexCount = TRIANGLE_VERTICES;

   m_pVertices = new ColorVertex[m_vertexCount];

   m_pVertices[0].setVertex(  0.5f,  0.5f, 0.0f, m_color );
   m_pVertices[1].setVertex(  0.5f, -0.5f, 0.0f, m_color );
   m_pVertices[2].setVertex( -0.5f, -0.5f, 0.0f, m_color );
}
/*-----------------------------------------------------------------------------------------------*/
void Triangle::draw(Renderer* renderer)
{
   Shape::draw(renderer);
   
   if ( isVisible() )
   {
      renderer->DrawElements( 3, m_pVertices, 1, TRIANGLE_STRIP );
   }
}